<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<% 
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/";
	pageContext.setAttribute("basePath",basePath);
%>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
		<title>非遗清单列表</title>
		<link rel="icon" href="<%=basePath %>views/gj/img/favicon.png" type="image/x-icon">
		<link rel="stylesheet" href="<%=basePath %>views/lcx/layui-v2.5.5/layui/css/layui.css" />
		<link rel="stylesheet" href="<%=basePath %>views/lcx/layui-v2.5.5/layui/css/modules/layer/default/layer.css" />
		<link rel="stylesheet" href="<%=basePath %>views/lcx/css/listManager.css" />
		<script src="<%=basePath %>views/lcx/layui-v2.5.5/layui/layui.js"></script>
		<script src="<%=basePath %>views/lcx/layui-v2.5.5/layui/lay/modules/layer.js"></script>
		<script type="text/javascript" src="<%=basePath %>views/lcx/js/jquery-3.3.1.min.js" ></script>
	</head>
	<body>
		<div class="my_right">
			<div class="box_right">展示类</div>
			<div class="pic_list">
				<ul>
					<c:choose>
						<c:when test="${size==0 }">
							<div>
								<img style="width: 775px" src="${basePath }views/lcx/img/12.jpg">
							
							</div>
						
						</c:when>
						<c:otherwise>
							<c:forEach items="${pageInfo.list}" var="c">
								<li>
									<a title="查看详情" href="${c.list_url}"><img src="${c.list_photo}" alt="content">${c.list_name }</a>
									<div onclick="dellist('${c.list_id}')" class="dellist" title="删除"><i class="layui-icon">&#xe640;</i></div>
								</li>
							</c:forEach>
						</c:otherwise>
					</c:choose>
					
				</ul>
			</div>
			<script type="text/javascript">
				$("li").mouseover(function(){
					$(this).css("margin-right","0");
					$(this).find(".dellist").css("display","inline-block");
				});
				$("li").mouseout(function(){
					$(this).css("margin-right","25px");
					$(this).find(".dellist").css("display","none");
				});
				function dellist(data){
					$.ajax({ //
						type : "get",
						url : "${basePath}dellistbyid", //添加操作的路径
						data : {listId:data},//添加用户的基本信息
						dataType : "JSON", //返回JSON格式的数据
						async : false,//同步传输
						success : function(data) {
							if(data==1){
								alert("删除成功！！");
							}else{
								alert("删除失败！！");
							}
						}
					});
					location.reload();//重新刷新页面
				}
			</script>
			<div id="demo6">
				<div class="layui-box layui-laypage layui-laypage-default" id="layui-laypage-1">
					<c:if test="${pageInfo.hasPreviousPage}">
						<a href="${basePath}listManagerInit?type=${type}&pageNo=${pageInfo.pageNum-1}" class="layui-laypage-prev">上一页</a>
					</c:if>
					<c:if test="${pageInfo.hasNextPage}">
						<a href="${basePath}listManagerInit?type=${type}&pageNo=${pageInfo.pageNum+1}" class="layui-laypage-next">下一页</a>
					</c:if>
				</div>
			</div>
		</div>
	</body>
</html>